﻿using System;
using System.Windows.Data;

namespace Coevery.PhoneApp.Convert
{
    public class MetadataConverter : IValueConverter   
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return value == null ? string.Empty : MetadataHelper.GetLocalizedLabel(parameter.ToString(), "description", value.ToString());
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return Convert(value, targetType, parameter, culture);
        }
    }
}
